import 'package:finance_app/src/entities/income_type_entity.dart';

incomeTypeEntityFromJson(IncomeTypeEntity data, Map<String, dynamic> json) {
	if (json['data_type'] != null) {
		data.dataType = json['data_type'].toString();
	}
	if (json['id'] != null) {
		data.id = json['id'] is String
				? int.tryParse(json['id'])
				: json['id'].toInt();
	}
	if (json['name'] != null) {
		data.name = json['name'].toString();
	}
	if (json['cpf_payable'] != null) {
		data.cpfPayable = json['cpf_payable'] is String
				? int.tryParse(json['cpf_payable'])
				: json['cpf_payable'].toInt();
	}
	if (json['wage_type'] != null) {
		data.wageType = json['wage_type'].toString();
	}
	return data;
}

Map<String, dynamic> incomeTypeEntityToJson(IncomeTypeEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['data_type'] = entity.dataType;
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['cpf_payable'] = entity.cpfPayable;
	data['wage_type'] = entity.wageType;
	return data;
}